<%-- 
    Document   : stdmaster_display
    Created on : Jan 11, 2013, 5:41:04 PM
    Author     : kk
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.sql.*,java.util.*,org.json.simple.*,org.json.simple.parser.*"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/shms", "root", "");
            String query="select * from student_master where gr_no=567 ;";
            Statement stmt=con.createStatement();
            ResultSet rst=stmt.executeQuery(query);
            
            ArrayList ar=new ArrayList();
            while (rst.next()) 
            {
                ar.add( rst.getString(4));
            }
            for(int i=0;i<ar.size();i++)
            {
                %>
                <%=ar.get(i)%>
                <%
                String details = (String) ar.get(i);
                
                JSONParser parser=new JSONParser();
                Object obj=parser.parse(details);
                JSONObject jsonobject=(JSONObject) obj;
                
                String firstname=(String) jsonobject.get("firstname");
                %>
                <%=firstname%>
                <%
            }
        }
        catch(Exception e){}
        %>
    </body>
</html>
